Change in openvpn[master]: Enable -Wtype-limits by default (via -Wextra)
A message that is not in the archive (sent off-list or not yet received): gerrit.1758627240000.Iaabddb6f81cd94863291b193aae9d384a8f9d871@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
to review the following change.
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
- Fix one check that assumed peer_id was signed.
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/init.c
M src/openvpn/socket.c
5 files changed, 17 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1207/1
CMakeLists.txt +1 -1
@@ -115,7 +115,7 @@ check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) # We are not ready for this #add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1398,7 +1398,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -400,6 +400,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -464,6 +471,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/init.c +1 -1
@@ -2724,7 +2724,7 @@/* Ensure that for epoch data format is only enabled if also data v2 * is enabled */ bool epoch_data = (c->options.imported_protocol_flags &CO_EPOCH_DATA_KEY_FORMAT ); -bool datav2_enabled = (c->options.peer_id >=0 && c->options.peer_id <MAX_PEER_ID ); +bool datav2_enabled = c->options.peer_id <MAX_PEER_ID ;if (epoch_data && !datav2_enabled) {
src/openvpn/socket.c +4 -2
@@ -572,7 +572,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + !=SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -603,7 +604,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + !=SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
to look at the new patch set (#2).
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
- Fix one check that assumed peer_id was signed.
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/init.c
M src/openvpn/socket.c
5 files changed, 17 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1207/2
CMakeLists.txt +1 -1
@@ -115,7 +115,7 @@ check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) # We are not ready for this #add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1398,7 +1398,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -400,6 +400,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -464,6 +471,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/init.c +1 -1
@@ -2724,7 +2724,7 @@/* Ensure that for epoch data format is only enabled if also data v2 * is enabled */ bool epoch_data = (c->options.imported_protocol_flags &CO_EPOCH_DATA_KEY_FORMAT ); -bool datav2_enabled = (c->options.peer_id >=0 && c->options.peer_id <MAX_PEER_ID ); +bool datav2_enabled = c->options.peer_id <MAX_PEER_ID ;if (epoch_data && !datav2_enabled) {
src/openvpn/socket.c +4 -2
@@ -572,7 +572,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -603,7 +604,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
to look at the new patch set (#3).
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
- Fix one check that assumed peer_id was signed.
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/init.c
M src/openvpn/socket.c
5 files changed, 17 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1207/3
CMakeLists.txt +1 -1
@@ -114,7 +114,7 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1399,7 +1399,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -409,6 +409,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -473,6 +480,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/init.c +1 -1
@@ -2729,7 +2729,7 @@/* Ensure that for epoch data format is only enabled if also data v2 * is enabled */ bool epoch_data = (c->options.imported_protocol_flags &CO_EPOCH_DATA_KEY_FORMAT ); -bool datav2_enabled = (c->options.peer_id >=0 && c->options.peer_id <MAX_PEER_ID ); +bool datav2_enabled = c->options.peer_id <MAX_PEER_ID ;if (epoch_data && !datav2_enabled) {
src/openvpn/socket.c +4 -2
@@ -577,7 +577,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -608,7 +609,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email )
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Patch Set 3: Code-Review-1
(1 comment)
File src/openvpn/init.c:
http://gerrit.openvpn.net/c/openvpn/+/1207/comment/c01e41e9_729132bc?usp=email :
PS3, Line 2732: bool datav2_enabled = c->options.peer_id < MAX_PEER_ID;
Yes that is correct from the standpoint of no sign compare but the check should be fixed to actually do what it says. Replace the first part with c->options.use_peer_id
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 14 Oct 2025 09:47:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review-1 by plaisthos
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/socket.c
4 files changed, 16 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1207/4
CMakeLists.txt +1 -1
@@ -114,7 +114,7 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1399,7 +1399,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -410,6 +410,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -474,6 +481,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/socket.c +4 -2
@@ -577,7 +577,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -608,7 +609,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
Signature · 14 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871 Gerrit-Change-Number: 1207 Gerrit-PatchSet: 4 Gerrit-Owner: flichtenheld <[email protected]...> Gerrit-Reviewer: plaisthos <[email protected]...> Gerrit-CC: openvpn-devel <[email protected]> Gerrit-Attention: plaisthos <[email protected]...> Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email )
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/init.c:
http://gerrit.openvpn.net/c/openvpn/+/1207/comment/2c9249b3_2d7cd62b?usp=email :
PS3, Line 2732: bool datav2_enabled = c->options.peer_id < MAX_PEER_ID;
Quoted 1 line
Yes that is correct from the standpoint of no sign compare but the check should be fixed to actually […]
https://gerrit.openvpn.net/c/openvpn/+/1273
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 14 Oct 2025 11:35:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email )
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Patch Set 6: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 11 Nov 2025 11:04:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v6 1/1 Enable -Wtype-limits by default (via -Wextra)
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207
This mail reflects revision 6 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
CMakeLists.txt +1 -1
@@ -114,7 +114,7 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1410,7 +1410,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -410,6 +410,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -474,6 +481,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/socket.c +4 -2
@@ -577,7 +577,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -608,7 +609,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
[Openvpn-devel] [PATCH applied] Re: Enable -Wtype-limits by default (via -Wextra)
Stared at it, complained about SOCKET_UNDEFINED, read up sysdefs.h...
Thrown at GHA, got aborts due to macOS 13 brownouting...
Not "smooth sailing" day, but still, in it goes.
Your patch has been applied to the master branch.
commit 5d50583bf853b62c0362a45a9ea1b085516bdd4e
Author: Frank Lichtenheld Date: Tue Nov 11 16:48:39 2025 +0100
Enable -Wtype-limits by default (via -Wextra)
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34317.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#7) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34317.html
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/socket.c
4 files changed, 16 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1207/7
CMakeLists.txt +1 -1
@@ -114,7 +114,7 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1410,7 +1410,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -410,6 +410,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -474,6 +481,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/socket.c +4 -2
@@ -577,7 +577,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -608,7 +609,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email )
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34317.html
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/socket.c
4 files changed, 16 insertions(+), 4 deletions(-)
CMakeLists.txt +1 -1
@@ -114,7 +114,7 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32)
configure.ac +1 -1
@@ -1410,7 +1410,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then
src/openvpn/event.c +10 -0
@@ -410,6 +410,13 @@ }#endif +/* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way +that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif +/* * First poll our event list with 0 timeout */
@@ -474,6 +481,9 @@return -1 ; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set *
src/openvpn/socket.c +4 -2
@@ -577,7 +577,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_STREAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"Cannot create TCP socket" ); }
@@ -608,7 +609,8 @@ASSERT (addrinfo);ASSERT (addrinfo->ai_socktype ==SOCK_DGRAM ); -if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) <0 ) +if ((sd =socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + ==SOCKET_UNDEFINED ) {msg (M_ERR ,"UDP: Cannot create UDP/UDP6 socket" ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>